FileAttributeF4This file shows how get and set attribute of a file.G
2000 Troi Automatisering `
isLockedj
Note: On Mac OS it may take some time (about 5 secs) before the change in a attribute is visible in the Finder. On Windows you need to refresh a Window before you see the change.k
Select a Filem Lock Filev
First select a test file.~ _gTheFile
_gErrorCode
Unlock File
archiveBit
isHidden
J Hide File
Unhide File
Set Archive
Reset Archive
N$this bit is only present on Windows.
OnBelow the attributes of the selected file are shown, you can change the attributes by clicking on the buttons.
PlIf you cancel $$-1 is returned. See the user guide and OSErrrs database for more information on error codes.
Close Demo File
A2This script will get let the user select a folder.B
|("TrFile-Get FileSpec Dialog"
"Please specify a file:")
TrFile-Get FileSpec Dialog
Please specify a file:|C;
2) <> "$$"
Make it a full pathE]
|("TrFile-FileSpec To FullPath"
TrFile-FileSpec To FullPath
A open file
) = 2
Get Lock Status
A,This script will return if a file is locked.
|("TrFile-Get FileSpec Dialog"
"Please select a file to lock/unlock:")
TrFile-Get FileSpec Dialog
$Please select a file to lock/unlock:|D:
2) <> "$$"
) = 1
|("TrFile-FileSpec To FullPath"
TrFile-FileSpec To FullPath
A Lock File
A;This script will return will lock a file (make it ReadOnly)Bh
|("TrFile-SetFileAttribute"
"-lock|"&
TrFile-SetFileAttribute
-lock|
Unlock File
A;This script will unlock a file (remove Read only Attrubute)Bl
|("TrFile-SetFileAttribute"
"-unlock|"&
TrFile-SetFileAttribute
-unlock|
Get Hidden Status
A,This script will return if a file is locked.Bt
|("TrFile-GetFileAttribute"
"-hiddenAttr|"&
TrFile-GetFileAttribute
-hiddenAttr|
2) ="$$"
|("TrFile-GetFileAttribute"
"-lockAttr|"&
TrFile-GetFileAttribute
-lockAttr|
2) ="$$"
"???"
-------------
A2This script will get let the user select a folder.B
|("TrFile-Get FileSpec Dialog"
"Please specify a file:")
TrFile-Get FileSpec Dialog
Please specify a file:|C;
2) <> "$$"
Make it a full pathE]
|("TrFile-FileSpec To FullPath"
TrFile-FileSpec To FullPath
A Hide File
A;This script will return will lock a file (make it ReadOnly)Bh
|("TrFile-SetFileAttribute"
"-hide|"&
TrFile-SetFileAttribute
-hide|
UnHide File
A;This script will return will lock a file (make it ReadOnly)
"???"
-------------
A2This script will get let the user select a folder.B
|("TrFile-Get FileSpec Dialog"
"Please specify a file:")
TrFile-Get FileSpec Dialog
Please specify a file:|C;
2) <> "$$"
Make it a full pathE]
|("TrFile-FileSpec To FullPath"
TrFile-FileSpec To FullPath
Get Archive Bit Status
A,This script will return if a file is locked.Bv
|("TrFile-GetFileAttribute"
"-ArchiveAttr|"&
TrFile-GetFileAttribute
-ArchiveAttr|
2) ="$$"
|("TrFile-SetFileAttribute"
"-unhide|"&
TrFile-SetFileAttribute
-unhide|
Set Archive Bit of File
A;This script will return will lock a file (make it ReadOnly)Bt
|("TrFile-SetFileAttribute"
"-SetArchive|"&
TrFile-SetFileAttribute
-SetArchive|
Reset Archive Bit of File
A;This script will return will lock a file (make it ReadOnly)Bx
|("TrFile-SetFileAttribute"
"-ResetArchive|"&
TrFile-SetFileAttribute
-ResetArchive|
-------------
A2This script will get let the user select a folder.B